#pragma once

#include <AVUIDefinitionBase.h>

namespace AVUI {

class Grid;

class RowDefinition : public DefinitionBase
{
    friend class RowDefinitionCollection;

public:
    RowDefinition() : DefinitionBase(false), m_pOwner(NULL) { }

    DECLARE_ELEMENT(RowDefinition, DefinitionBase);

    DECLARE_DEPENDENCY_PROPERTY(Height);
    GridLength get_Height() { return AVUI::UnboxValue<GridLength>(GetValue(get_HeightProperty())); }
    void set_Height(const GridLength& value) { SetValue(get_HeightProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(MinHeight);
    float get_MinHeight() { return AVUI::UnboxValue<float>(GetValue(get_MinHeightProperty())); }
    void set_MinHeight(float value) { SetValue(get_MinHeightProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(MaxHeight);
    float get_MaxHeight() { return AVUI::UnboxValue<float>(GetValue(get_MaxHeightProperty())); }
    void set_MaxHeight(float value) { SetValue(get_MaxHeightProperty(), AVUI::BoxValue(value)); } 

    float get_ActualHeight();

private:
    static void StaticConstructor();

    static void OnPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);

    void set_Owner(Grid* pOwner)
    {
        if(m_pOwner != NULL)
        {
            LibraryCriticalError();
        }

        m_pOwner = pOwner;
    }

    Grid* m_pOwner;
};


}; // namespace AVUI
